Conversation
The unauthenticated POST /validate endpoint passed a client-controlled filename directly into os.path.join(TMP_DIR, filename). Because os.path.join discards the base when the second argument is absolute, and no traversal/separator checks existed, a caller could write uploaded content to arbitrary locations in the Lambda's writable area (/tmp), poisoning the shared pyQuARC cache (CACHE_DIR=/tmp) or filling the disk. Changes: - Add safe_upload_path(): keep only a sanitized basename of the client filename and write into a fresh per-request /tmp/uploads/<uuid>/ directory, with a post-resolution containment check. Neutralizes absolute paths, ../ traversal, nested paths, and cross-request collisions in warm containers. Also fixes a crash when filename is omitted (path.join(TMP_DIR, None) -> TypeError). - Move wrap_inputs() inside try/finally so the per-request AUTH_TOKEN env var is always cleared and uploads are always removed, preventing token leakage into a subsequent request in a warm container. - Stop echoing auth_key and raw file content back in the response params. - Return only the uploaded file's basename in results, never the server path. - Throttle the public API stage (rate 20/burst 40) as defense in depth. CWE-22, CWE-73.
The runners dropped Python 3.8, so the lint workflow failed with "Version 3.8 with arch x64 not found", and the older action majors run on the now-deprecated Node 20. - lint.yml: setup-python@v1 (3.8) -> @v6 (3.9), matching the Lambda runtime and the deploy workflows; checkout@v2 -> @v5; wearerequired/lint-action@v1 -> @v2. - deploy.yml / update_pyquarc.yml: checkout@v2 -> @v5, configure-aws-credentials@v1 -> @v4, setup-python@v2 -> @v6. - deploy.yml: setup-node@v2 -> @v5 and bump the CDK build Node from the EOL 14.15.1 to 20 LTS.
The lint workflow flagged pre-existing issues in the deploy package: - flake8 F401: remove unused DockerImage import in stack.py. - black: reformat the BundlingOptions command list onto separate lines and drop the extra blank line in app.py. All 8 tracked Python files now pass `black --check --line-length 100` and `flake8`.
…ation Update GitHub Actions to Node 24 majors and Python 3.9
…dp2966 Fix arbitrary file write in /validate endpoint (VDP-2966)
xhagrg
approved these changes
Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog
#43
#42